package com.member.shop.service.impl;

import java.util.Arrays;
import java.util.List;

import com.member.common.utils.DateUtils;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.member.shop.vo.RankInfoVo;
import org.springframework.stereotype.Service;
import com.member.shop.mapper.SysBizRankListMapper;
import com.member.shop.domain.SysBizRankList;
import com.member.shop.service.ISysBizRankListService;

/**
 * 排行榜单Service业务层处理
 *
 * @author lixinchen
 * @date 2025-01-11
 */
@Service
public class SysBizRankListServiceImpl extends ServiceImpl<SysBizRankListMapper, SysBizRankList> implements ISysBizRankListService {
    @Resource
    private SysBizRankListMapper sysBizRankListMapper;

    /**
     * 查询排行榜单
     *
     * @param id 排行榜单主键
     * @return 排行榜单
     */
    @Override
    public SysBizRankList selectSysBizRankListById(Long id) {
        return sysBizRankListMapper.selectById(id);
    }

    /**
     * 查询排行榜单列表
     *
     * @param queryWrapper 排行榜单
     * @return 排行榜单
     */
    @Override
    public List<SysBizRankList> selectSysBizRankListList(LambdaQueryWrapper<SysBizRankList> queryWrapper) {
        return sysBizRankListMapper.selectList(queryWrapper);
    }

    @Override
    public List<SysBizRankList> selectSysBizRankListList(SysBizRankList sysBizRankList) {
        return sysBizRankListMapper.selectSysBizRankListList(sysBizRankList);
    }

    /**
     * 新增排行榜单
     *
     * @param sysBizRankList 排行榜单
     * @return 结果
     */
    @Override
    public int insertSysBizRankList(SysBizRankList sysBizRankList) {
        sysBizRankList.setCreateTime(DateUtils.getNowDate());
        return sysBizRankListMapper.insert(sysBizRankList);
    }

    /**
     * 修改排行榜单
     *
     * @param sysBizRankList 排行榜单
     * @return 结果
     */
    @Override
    public int updateSysBizRankList(SysBizRankList sysBizRankList) {
        sysBizRankList.setUpdateTime(DateUtils.getNowDate());
        return sysBizRankListMapper.updateById(sysBizRankList);
    }

    /**
     * 批量删除排行榜单
     *
     * @param ids 需要删除的排行榜单主键
     * @return 结果
     */
    @Override
    public int deleteSysBizRankListByIds(Long[] ids) {
        return sysBizRankListMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除排行榜单信息
     *
     * @param id 排行榜单主键
     * @return 结果
     */
    @Override
    public int deleteSysBizRankListById(Long id) {
        return sysBizRankListMapper.deleteById(id);
    }

    @Override
    public RankInfoVo selectSysBizRankListByGoodsId(Long goodsId) {
        return sysBizRankListMapper.selectSysBizRankListByGoodsId(goodsId);
    }
}
